<template>
  <div>
    <div>
      <el-button
        v-if="props.open.isShow"
        :type="rowData.flag !== 0 ? 'primary' : ''"
        size="small"
        @click="emit('openInstruct')"
        >{{ rowData.flag === 0 ? "关闭" : "启用" }}
      </el-button>
      <el-button
        v-if="props.edit.isShow"
        size="small"
        @click="emit('editInstruct')"
        :disabled="rowData.flag === 0"
      >
        编辑
      </el-button>
    </div>

    <div style="margin-top: 5px">
      <el-button size="small" @click="emit('handleDescribe')">备注 </el-button>
      <el-popconfirm
        v-if="props.delete.isShow"
        title="确认要删除吗?"
        confirm-button-text="删除"
        cancel-button-text="不删除"
        confirm-button-type="text"
        cancel-button-type="primary"
        @confirm="emit('deleteInstruct')"
      >
        <template #reference>
          <el-button size="small" type="danger" :disabled="rowData.flag === 0">
            删除
          </el-button>
        </template>
      </el-popconfirm>
    </div>
  </div>
</template>

<script setup lang="ts">
const props = defineProps<{
  open: { isShow: Boolean };
  edit: { isShow: Boolean };
  delete: { isShow: Boolean };
  rowData: any;
}>();
const emit = defineEmits([
  "openInstruct",
  "editInstruct",
  "deleteInstruct",
  "handleDescribe",
]);
</script>
